package com.priserve.retirement.entities;

// Generated Apr 27, 2013 9:50:19 PM by Hibernate Tools 4.0.0

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Home object for domain model class Advisor.
 * @see com.priserve.retirement.entities.Advisor
 * @author Hibernate Tools
 */
@Stateless
public class AdvisorHome {

	private static final Log log = LogFactory.getLog(AdvisorHome.class);

	@PersistenceContext
	private EntityManager entityManager;

	public void persist(Advisor transientInstance) {
		log.debug("persisting Advisor instance");
		try {
			entityManager.persist(transientInstance);
			log.debug("persist successful");
		} catch (RuntimeException re) {
			log.error("persist failed", re);
			throw re;
		}
	}

	public void remove(Advisor persistentInstance) {
		log.debug("removing Advisor instance");
		try {
			entityManager.remove(persistentInstance);
			log.debug("remove successful");
		} catch (RuntimeException re) {
			log.error("remove failed", re);
			throw re;
		}
	}

	public Advisor merge(Advisor detachedInstance) {
		log.debug("merging Advisor instance");
		try {
			Advisor result = entityManager.merge(detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public Advisor findById(Long id) {
		log.debug("getting Advisor instance with id: " + id);
		try {
			Advisor instance = entityManager.find(Advisor.class, id);
			log.debug("get successful");
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}
}
